package com.petsbang.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;

import com.petsbang.action.R;


public class DialogInfo {

	// 退出软件
	public static void showExitDialog(final Activity context) {
		if (context.isFinishing()) {
			return;
		}
		new AlertDialog.Builder(context)
				.setTitle(R.string.out_hint)
				.setMessage(R.string.out_hint_content)
				.setPositiveButton(R.string.out_hint_sub,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int whichButton) {
								android.os.Process
										.killProcess(android.os.Process.myPid());
								context.finish();
							}
						})
				.setNegativeButton(R.string.out_hint_cannel,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int whichButton) {
							}
						}).show();
	}

	// 提示设置连网方式
	public static void showWifiDialog(final Activity context) {
		if (context.isFinishing()) {
			return;
		}
		new AlertDialog.Builder(context)
				.setTitle(R.string.net_hint)
				.setMessage(R.string.net_hint_content)
				.setPositiveButton(R.string.net_hint_sub,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int whichButton) {
								context.startActivityForResult(
										new Intent(
												android.provider.Settings.ACTION_WIRELESS_SETTINGS),
										0);
							}
						})
				.setNegativeButton(R.string.net_hint_cannel,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int whichButton) {
								context.finish();
							}
						}).show();
	}
}
